﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_PET_IMAGE
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtPET_IMAGE_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(this.txtNAME.Text.Trim().Length==0)
			{
				strErr+="名称不能为空！\\n";	
			}
			if(this.txtPATH.Text.Trim().Length==0)
			{
				strErr+="路径不能为空！\\n";	
			}
			if(this.txtREG_ORG_ID.Text.Trim().Length==0)
			{
				strErr+="机构ID不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATE_TIME.Text))
			{
				strErr+="创建时间格式错误！\\n";	
			}
			if(this.txtCREATOR_ID.Text.Trim().Length==0)
			{
				strErr+="创建人ID不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtUPDATE_TIME.Text))
			{
				strErr+="更新时间格式错误！\\n";	
			}
			if(this.txtUPDATOR_ID.Text.Trim().Length==0)
			{
				strErr+="更新人ID不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtATTACHMENT_TYPE.Text))
			{
				strErr+="附件类型格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string PET_IMAGE_ID=this.txtPET_IMAGE_ID.Text;
			string NAME=this.txtNAME.Text;
			string PATH=this.txtPATH.Text;
			string REG_ORG_ID=this.txtREG_ORG_ID.Text;
			DateTime CREATE_TIME=DateTime.Parse(this.txtCREATE_TIME.Text);
			string CREATOR_ID=this.txtCREATOR_ID.Text;
			DateTime UPDATE_TIME=DateTime.Parse(this.txtUPDATE_TIME.Text);
			string UPDATOR_ID=this.txtUPDATOR_ID.Text;
			decimal ATTACHMENT_TYPE=decimal.Parse(this.txtATTACHMENT_TYPE.Text);
			decimal ID=decimal.Parse(this.txtID.Text);

			MidSoft.Model.Model_T_PET_IMAGE model=new MidSoft.Model.Model_T_PET_IMAGE();
			model.PET_IMAGE_ID=PET_IMAGE_ID;
			model.NAME=NAME;
			model.PATH=PATH;
			model.REG_ORG_ID=REG_ORG_ID;
			model.CREATE_TIME=CREATE_TIME;
			model.CREATOR_ID=CREATOR_ID;
			model.UPDATE_TIME=UPDATE_TIME;
			model.UPDATOR_ID=UPDATOR_ID;
			model.ATTACHMENT_TYPE=ATTACHMENT_TYPE;
			model.ID=ID;

			MidSoft.BLL.BLL_T_PET_IMAGE bll=new MidSoft.BLL.BLL_T_PET_IMAGE();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
